const { host }= require('../../mockConfig')

Page({
  data: {
    keywords: '',
    list: []
  },

  handleInput({detail: { value }}) {
    this.setData({
      keywords: value
    })
  },

  handleSearch() {
    const keywords = this.data.keywords
    wx.request({
      url: `${host}/data?message_like=${keywords}`,
      success: (result) => {
        this.setData({
          list: result.data,
          keywords: ''
        })
      }
    })
  }
})